package com.dmtt.web.common;

import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.SchedulingConfigurer;
import org.springframework.scheduling.config.ScheduledTaskRegistrar;

import java.util.concurrent.Executors;
import java.util.logging.Logger;

/**
 * 定时任务多线程
 */
public class SchouldConfig implements SchedulingConfigurer {
    private Logger logger = (Logger) LoggerFactory.getLogger(SchedulingConfigurer.class);
    @Override
    public void configureTasks(ScheduledTaskRegistrar taskRegistrar) {
        logger.info("定时任务配置4个线程");
        taskRegistrar.setScheduler(Executors.newScheduledThreadPool(4));
    }
}
